//
//  SLSelectWatercraftBtn.m
//  StarLight
//
//  Created by Apple on 16/8/23.
//  Copyright © 2016年 Duke.Wu. All rights reserved.
//

// 说明: 自定义按钮,更换图片和文字的显示位置

#import "SLSelectWatercraftBtn.h"

@implementation SLSelectWatercraftBtn

// 从写该方法取消按钮的高亮状态
- (void)setHighlighted:(BOOL)highlighted
{}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    if (self.imageView.x < self.titleLabel.x) {
        
        self.titleLabel.x = self.imageView.x;
        
        self.imageView.x = CGRectGetMaxX(self.titleLabel.frame);
        
    }
}


- (void)setTitle:(NSString *)title forState:(UIControlState)state
{
    [super setTitle:title forState:state];
    
    [self sizeToFit];
}

@end
